<template>
  <a-config-provider :locale="locale">
    <div id="app">
      <router-view />
    </div>
  </a-config-provider>
</template>
<script>
import zhCN from 'ant-design-vue/lib/locale-provider/zh_CN'
import enquireScreen from '@/utils/device'
import ScreenShort from 'js-web-screen-shot'
export default {
  data() {
    return {
      locale: zhCN,
    }
  },
  created() {
    let that = this
    enquireScreen((deviceType) => {
      // tablet
      if (deviceType === 0) {
        that.$store.commit('TOGGLE_DEVICE', 'mobile')
        that.$store.dispatch('setSidebar', false)
      }
      // mobile
      else if (deviceType === 1) {
        that.$store.commit('TOGGLE_DEVICE', 'mobile')
        that.$store.dispatch('setSidebar', false)
      } else {
        that.$store.commit('TOGGLE_DEVICE', 'desktop')
        that.$store.dispatch('setSidebar', true)
      }
    })
  },
  mounted() {
    document.onkeyup =  (event) => {
      if(event.ctrlKey && event.keyCode == 13){
        this.initScreenShortOpen();
      }
    }
  },
  methods : {
    initScreenShortOpen(){
      let canvasWidth = document.documentElement.scrollWidth;
      let canvasHeight = document.documentElement.scrollHeight;
      new ScreenShort({
        'enableWebRtc': false,
        'canvasWidth': canvasWidth,
        'canvasHeight': canvasHeight,
      })
    }
  }
}
</script>
<style>
#app {
  height: 100%;
}
 #toolPanel{
  box-sizing: content-box !important;
}
::-webkit-scrollbar{
  width: 0px !important;
}
</style>